package edu.ccut.saturn.workflow.finishTaskModule.code;

import java.util.HashMap;

import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IParameterContext;
import edu.ccut.saturn.component.SaturnData;

public class SetUserInfointoWorkFlowParamMap extends DefaultComponent {
	@SuppressWarnings("unchecked")
	@Override
	public void execute(IParameterContext parameterContext) throws Exception {
		SaturnData userInstance = (SaturnData)parameterContext.getParameterValue(0);
		HashMap<String,String> workFlowParamMap= (HashMap<String, String>)parameterContext.getParameterValue(1);
		if(userInstance!=null){
			workFlowParamMap.put("userName", userInstance.getString("username"));
			workFlowParamMap.put("userDepartment", userInstance.getString("dept_id"));
		}else{
			workFlowParamMap.put("userName", null);
			workFlowParamMap.put("userDepartment", null);
		}
		parameterContext.setParameter(1, workFlowParamMap);
	}
}